package com.softwareinlife.android.ux;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

public class WriteVisionTest extends Activity implements OnTouchListener {
	/** Called when the activity is first created. */

	public Float x1;// ��ġ�̺�Ʈ �ߵ� �� ��� �Ǵ� x��ǥ�� ��
	public Float y1;// ��ġ �̺�Ʈ �ߵ� �� ��� �Ǵ� y��ǥ�� ��

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:

			x1 = event.getX();// ����� �� x�� ���Ͷ�~

			y1 = event.getY();// ����� �� y�� ���Ͷ�~��������

			try {
				System.out.println("x : " + x1.toString());
				System.out.println("y : " + y1.toString());

			} catch (Exception e) {
			}

			if (x1 >= 235 && x1 <= 266 && y1 >= 345 && y1 <= 366) {

				openDialog();
			}
			break;
		}
		return true;

	}

	public void openDialog() {

		// ���̾Ʒα� ����� Ÿ��Ʋ�� array.xml�� �ִ� �� .. �����۵� ������ ..
		new AlertDialog.Builder(this)

		.setTitle(R.string.submit)

		.setItems(R.array.submit,

		new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialoginterface, int i) {

				try {

					System.out.println("i = " + i);

				} catch (Exception e) {
					System.out.println("huk!");
				}

				if (i == 0) {
					Intent intent = new Intent(WriteVisionTest.this,
							StandAlone.class);
					startActivity(intent);
				}

				else if (i == 1) {

				}

			}
		}).show();
	}

	@Override
	// ��ġ �̺�Ʈ �ۼ��ϸ� �ڵ����� ���� ��? �ƴ� ����;;
	public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub
		return false;
	}

}